home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Form1"
- ClientHeight = 3195
- ClientLeft = 60
- ClientTop = 345
- ClientWidth = 4680
- LinkTopic = "Form1"
- ScaleHeight = 3195
- ScaleWidth = 4680
- StartUpPosition = 3 'Windows Default
- Begin VB.CommandButton Command1
- Caption = "Command1"
- Height = 1215
- Left = 720
- TabIndex = 0
- Top = 600
- Width = 3255
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub Command1_Click()
- 'Define an input data array using the exclusive-or data
- Dim inputData(0 To 1, 0 To 3) As Variant
- inputData(0, 0) = -1!
- inputData(0, 1) = -1!
- inputData(0, 2) = 1!
- inputData(0, 3) = 1!
- inputData(1, 0) = -1!
- inputData(1, 1) = 1!
- inputData(1, 2) = -1!
- inputData(1, 3) = 1!
- 'Define a desired data array using the exclusive-or data
- Dim desiredData(0 To 0, 0 To 3) As Variant
- desiredData(0, 0) = -1!
- desiredData(0, 1) = 1!
- desiredData(0, 2) = 1!
- desiredData(0, 3) = -1!
- 'Create and new neural network object of the type NSLearningNetwork
- Dim nn As New NSLearningNetwork
- 'Set the pathName to the generated neural network DLL
- nn.dllPathName = "C:\Program Files\NeuroSolutions 4\Wizards\CustomSolutionWizard\Examples\DLL\MLP.dll"
- 'Set the pathName to the weights file saved by the Custom Solution Wizard
- nn.loadWeights "C:\Program Files\NeuroSolutions 4\Wizards\CustomSolutionWizard\Examples\DLL\MLP.nsw"
- 'Set the input data defined above as the input data
- nn.inputData = inputData
- 'Set the desired data defined above as the desired data
- nn.desiredData = desiredData
- 'Train the neural network for 100 epochs
- nn.train 100
- 'Get the network response (output)
- Dim networkOutput As Variant
- networkOutput = nn.getResponse
- 'Display the network output in a message box
- Dim outputString As String
- outputString = ""
- Dim exemplarNum As Integer, outputNum As Integer
- For exemplarNum = LBound(networkOutput, 1) To UBound(networkOutput, 1)
- For outputNum = LBound(networkOutput, 2) To UBound(networkOutput, 2)
- outputString = outputString & "Output(" & exemplarNum & ", " & outputNum & ") = " & networkOutput(exemplarNum, outputNum) & Chr(13) & Chr(10)
- Next outputNum
- Next exemplarNum
- MsgBox outputString
- Set nn = Nothing
- End Sub
-